package com.rt.easyjava.base.biz1.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rt.easyjava.base.biz1.bean.TmptAuthDeptBiz;
import com.rt.easyjava.base.biz1.dto.TmptAuthDeptBizDto;
import com.rt.easyjava.base.biz1.mapper.TmptAuthDeptBizMapper;
import com.rt.easyjava.base.biz1.service.impl.base.TmptAuthDeptServiceImpl;
import com.rt.easyjava.base.biz1.service.intf.TmptAuthDeptBizService;
import com.rt.easyjava.common.base.Result;
import com.rt.easyjava.common.config.dozer.MyMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 *  服务实现类
 * @author wuxiaoyong
 * @since 2020-07-17
 */
@Slf4j
@Service(value = "tmptAuthDeptService")
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
public class TmptAuthDeptBizServiceImpl extends TmptAuthDeptServiceImpl implements TmptAuthDeptBizService{
    @Autowired
    private MyMapper mapper;
    @Resource
    private TmptAuthDeptBizMapper tmptAuthDeptBizMapper;

    // ==================================================================================
    // ========== 以下使用的是 Mybatis-plus 实现, 适合单表操作 ==============================
    // ==================================================================================

    /**
    * create a object
    * @param tmptAuthDeptBizDto
    * @return
    */
    @Override
    public Result<TmptAuthDeptBizDto> create(TmptAuthDeptBizDto tmptAuthDeptBizDto) {
        return super.create(tmptAuthDeptBizDto);
    }

    /**
    * update a object by Id
    * @param tmptAuthDeptBizDto
    * @param updateWrapper
    * @return
    */
    @Override
    public Result<TmptAuthDeptBizDto> update(TmptAuthDeptBizDto tmptAuthDeptBizDto, UpdateWrapper updateWrapper) {
        return super.update(tmptAuthDeptBizDto, updateWrapper);
    }

    /**
    * 分页 (无合计功能)
    * @param page
    * @param queryWrapper
    * @return
    */
    public Result<TmptAuthDeptBizDto> page(Page<TmptAuthDeptBiz> page, QueryWrapper<TmptAuthDeptBiz> queryWrapper){
        return super.page(page, queryWrapper);
    }

    /**
    * select all by queryWrapper
    * @param queryWrapper
    * @return
    */
    @Override
    public Result<TmptAuthDeptBizDto> selectBy(QueryWrapper<TmptAuthDeptBiz> queryWrapper) {
        return super.selectBy(queryWrapper);
    }

    /**
    * select one by id
    * @param id
    * @return
    */
    @Override
    public Result<TmptAuthDeptBizDto> selectById(Long id) {
        return super.selectById(id);
    }




    // ==================================================================================
    // ========== 以下使用的是自定义的 mapper.xml 实现, 适合多表查询 =========================
    // ==================================================================================

    /**
    * 分页查询：mybatis plus 自定义sql分页查询
    * 默认开启合计查询，按需注掉代码
    * @param page
    * @param queryWrapper
    * @return
    */
    @Override
    public Result<TmptAuthDeptBizDto> myPage(Page<TmptAuthDeptBiz> page, QueryWrapper<TmptAuthDeptBiz> queryWrapper) {
        return super.myPage(page, queryWrapper);
    }

    @Override
    public Result<TmptAuthDeptBizDto> mySelectBy(QueryWrapper<TmptAuthDeptBiz> queryWrapper) {
        return super.mySelectBy(queryWrapper);
    }

    @Override
    public Result<TmptAuthDeptBizDto> mySelectById(long id) {
        return super.mySelectById(id);
    }

}
